<?php $url = new Url();?>
<div class="left">
    <?php $this->widget("AdminKetquaTrongngay")?>
    <?php $this->widget("AdminKetquaXoso")?>
</div>
<div class="right-main">
    <div class="righ-cont">
        <div class="right">
            <div class="title_style">
                <span><b>Kết quả xổ số Miền Bắc</b></span>
            </div>
            <?php $day = getdate(time()); ?>
            <p>Mở thưởng tại Hà Nội <?=StringUtils::getDayViText($day["wday"])?>, <?=date("d/m/Y",time()) ?></p>
            <div class="tablestyle clearfix">
                <table cellspacing="0" cellpadding="0" border="0" width="100%">
                    <tbody>   
                        <tr>
                            <td>
                                <div class="table clearfix">
                                    <table cellspacing="0" cellpadding="0" border="0" width="100%">
                                        <tbody>   

                                            <tr>
                                                <td width="20%" class="text-left"><strong class="s16">Giải đặc biệt</strong></td>
                                                <td width="70%" class="text-left">
                                                    <b class="clred">
                                                        <input type="text" id="giai_dacbiet" name="giai_dacbiet" value="<?=isset($row["giai_dacbiet"])?$row["giai_dacbiet"]:"" ?>" style="width: 120px;"/>
                                                    </b><span id="giai_db"></span>
                                                </td>
                                                <td width="20%" class="bg_yellow"><a href="javascript:void(0);" onclick="saveDacbiet();" class="save"> Save</a></td>
                                            </tr>
                                            <tr>
                                                <td class="text-left"><strong>Giải  nhất</strong></td>
                                                <td class="text-left">
                                                    <b class="clblue">
                                                        <input type="text" id="giai_nhat" name="giai_nhat" value="<?=isset($row["giai_nhat"])?$row["giai_nhat"]:"" ?>" style="width: 120px;"/>
                                                    </b><span id="giai_mot"></span>
                                                </td>
                                                <td width="20%" class="bg_yellow"><a href="javascript:void(0);" onclick="saveGiaiNhat();" class="save"> Save</a></td>
                                            </tr>
                                            <tr>
                                                <td class="text-left"><strong>Giải  nhì</strong></td>
                                                <td class="text-left">
                                                    <b class="clblue">
                                                        <input type="text" id="giai_nhi_1" name="giai_nhi_1" value="<?=isset($row["giai_nhi_1"])?$row["giai_nhi_1"]:"" ?>" style="width: 70px;"/>
                                                        -
                                                        <input type="text" id="giai_nhi_2" name="giai_nhi_2" value="<?=isset($row["giai_nhi_2"])?$row["giai_nhi_2"]:"" ?>" style="width: 70px;"/>
                                                    </b><span id="giai_nhi"></span></td>
                                                <td width="20%" class="bg_yellow"><a href="javascript:void(0);" onclick="saveGiaiNhi();" class="save"> Save</a></td>
                                            </tr>
                                            <tr>
                                                <td class="text-left"><strong>Giải  ba</strong></td>
                                                <td class="text-left">
                                                    <b class="clblue">
                                                        <input type="text" id="giai_ba_1" name="giai_ba_1" value="<?=isset($row["giai_ba_1"])?$row["giai_ba_1"]:"" ?>" style="width: 35px;"/>
                                                        -
                                                        <input type="text" id="giai_ba_2" name="giai_ba_2" value="<?=isset($row["giai_ba_2"])?$row["giai_ba_2"]:"" ?>" style="width: 35px;"/>
                                                        -
                                                        <input type="text" id="giai_ba_3" name="giai_ba_3" value="<?=isset($row["giai_ba_3"])?$row["giai_ba_3"]:"" ?>" style="width: 35px;"/>
                                                        -
                                                        <input type="text" id="giai_ba_4" name="giai_ba_4" value="<?=isset($row["giai_ba_4"])?$row["giai_ba_4"]:"" ?>" style="width: 35px;"/>
                                                        -
                                                        <input type="text" id="giai_ba_5" name="giai_ba_5" value="<?=isset($row["giai_ba_5"])?$row["giai_ba_5"]:"" ?>" style="width: 35px;"/>
                                                        -
                                                        <input type="text" id="giai_ba_6" name="giai_ba_6" value="<?=isset($row["giai_ba_6"])?$row["giai_ba_6"]:"" ?>" style="width: 35px;"/>
                                                    </b><span id="giai_ba"></span></td>
                                                <td width="20%" class="bg_yellow"><a href="javascript:void(0);" onclick="saveGiaiBa();" class="save"> Save</a></td>
                                            </tr>
                                            <tr>
                                                <td class="text-left"><strong>Giải  tư</strong></td>
                                                <td class="text-left">
                                                    <b class="clblue">
                                                        <input type="text" id="giai_tu_1" name="giai_tu_1" value="<?=isset($row["giai_tu_1"])?$row["giai_tu_1"]:"" ?>" style="width: 60px;"/>
                                                        -
                                                        <input type="text" id="giai_tu_2" name="giai_tu_2" value="<?=isset($row["giai_tu_2"])?$row["giai_tu_2"]:"" ?>" style="width: 60px;"/>
                                                        -
                                                        <input type="text" id="giai_tu_3" name="giai_tu_3" value="<?=isset($row["giai_tu_3"])?$row["giai_tu_3"]:"" ?>" style="width: 60px;"/>
                                                        -
                                                        <input type="text" id="giai_tu_4" name="giai_tu_4" value="<?=isset($row["giai_tu_4"])?$row["giai_tu_4"]:"" ?>" style="width: 60px;"/>
                                                    </b><span id="giai_tu"></span>
                                                </td>
                                                <td width="20%" class="bg_yellow"><a href="javascript:void(0);" onclick="saveGiaiTu();" class="save"> Save</a></td>
                                            </tr>
                                            <tr>
                                                <td class="text-left"><strong>Giải  năm</strong></td>
                                                <td class="text-left">
                                                    <b class="clblue">
                                                        <input type="text" id="giai_nam_1" name="giai_nam_1" value="<?=isset($row["giai_nam_1"])?$row["giai_nam_1"]:"" ?>" style="width: 35px;"/>
                                                        -
                                                        <input type="text" id="giai_nam_2" name="giai_nam_2" value="<?=isset($row["giai_nam_2"])?$row["giai_nam_2"]:"" ?>" style="width: 35px;"/>
                                                        -
                                                        <input type="text" id="giai_nam_3" name="giai_nam_3" value="<?=isset($row["giai_nam_3"])?$row["giai_nam_3"]:"" ?>" style="width: 35px;"/>
                                                        -
                                                        <input type="text" id="giai_nam_4" name="giai_nam_4" value="<?=isset($row["giai_nam_4"])?$row["giai_nam_4"]:"" ?>" style="width: 35px;"/>
                                                        -
                                                        <input type="text" id="giai_nam_5" name="giai_nam_5" value="<?=isset($row["giai_nam_5"])?$row["giai_nam_5"]:"" ?>" style="width: 35px;"/>
                                                        -
                                                        <input type="text" id="giai_nam_6" name="giai_nam_6" value="<?=isset($row["giai_nam_6"])?$row["giai_nam_6"]:"" ?>" style="width: 35px;"/>
                                                    </b><span id="giai_nam"></span>
                                                </td>
                                                <td width="20%" class="bg_yellow"><a href="javascript:void(0);" onclick="saveGiaiNam();" class="save"> Save</a></td>
                                            </tr>
                                            <tr>
                                                <td class="text-left"><strong>Giải  sáu</strong></td>
                                                <td class="text-left">
                                                    <b class="clblue">
                                                        <input type="text" id="giai_sau_1" name="giai_sau_1" value="<?=isset($row["giai_sau_1"])?$row["giai_sau_1"]:"" ?>" style="width: 70px;"/>
                                                        -
                                                        <input type="text" id="giai_sau_2" name="giai_sau_2" value="<?=isset($row["giai_sau_2"])?$row["giai_sau_2"]:"" ?>" style="width: 70px;"/>
                                                        -
                                                        <input type="text" id="giai_sau_3" name="giai_sau_3" value="<?=isset($row["giai_sau_3"])?$row["giai_sau_3"]:"" ?>" style="width: 70px;"/>
                                                    </b><span id="giai_sau"></span>
                                                </td>
                                                <td width="20%" class="bg_yellow"><a href="javascript:void(0);" onclick="saveGiaiSau();" class="save"> Save</a></td>
                                            </tr>
                                            <tr>
                                                <td class="text-left"><strong>Giải  bảy</strong></td>
                                                <td class="text-left">
                                                    <b class="clblue">
                                                        <input type="text" id="giai_bay_1" name="giai_bay_1" value="<?=isset($row["giai_bay_1"])?$row["giai_bay_1"]:"" ?>" style="width: 50px;"/>
                                                        -
                                                        <input type="text" id="giai_bay_2" name="giai_bay_2" value="<?=isset($row["giai_bay_2"])?$row["giai_bay_2"]:"" ?>" style="width: 50px;"/>
                                                        -
                                                        <input type="text" id="giai_bay_3" name="giai_bay_3" value="<?=isset($row["giai_bay_3"])?$row["giai_bay_3"]:"" ?>" style="width: 50px;"/>
                                                        -
                                                        <input type="text" id="giai_bay_4" name="giai_bay_4" value="<?=isset($row["giai_bay_4"])?$row["giai_bay_4"]:"" ?>" style="width: 50px;"/>
                                                    </b><span id="giai_bay"></span></td>
                                                <td width="20%" class="bg_yellow"><a href="javascript:void(0);" onclick="saveGiaiBay();" class="save"> Save</a></td>
                                            </tr>
                                        </tbody>
                                    </table>
                                </div>
                            </td>
                            <td width="60"><a href="javascript:void(0)" onclick="location.reload();" class="next"></a></td>
                            <td>
                                <div class="table clearfix">
                                    <table cellspacing="0" cellpadding="0" border="0" width="100%">
                                        <tbody>   
                                            <tr>
                                                <td width="20%" class="text-left"><strong class="s16">Giải đặc biệt</strong></td>
                                                <td width="70%" class="text-left"><b class="clred" id="gdb"><?=isset($row["giai_dacbiet"])?$row["giai_dacbiet"]:"?" ?></b></td>
                                            </tr>
                                            <tr>
                                                <td class="text-left"><strong>Giải  nhất</strong></td>
                                                <td class="text-left"><b class="clblue" id="g1"><?=isset($row["giai_nhat"])?$row["giai_nhat"]:"?" ?></b></td>
                                            </tr>
                                            <tr>
                                                <td class="text-left"><strong>Giải  nhì</strong></td>
                                                <td class="text-left"><b class="clblue" id="g21">
                                                    <?=isset($row["giai_nhi_1"])?$row["giai_nhi_1"]:"?" ?></b>
                                                    &nbsp;-&nbsp;
                                                    <b class="clblue" id="g21">
                                                        <?=isset($row["giai_nhi_2"])?$row["giai_nhi_2"]:"?" ?>
                                                    </b>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td class="text-left"><strong>Giải  ba</strong></td>
                                                <td class="text-left">
                                                    <b class="clblue" id="g31">
                                                    <?=isset($row["giai_ba_1"])?$row["giai_ba_1"]:"?" ?></b>
                                                    </b>
                                                    &nbsp;-&nbsp;
                                                    <b class="clblue" id="g32">
                                                        <?=isset($row["giai_ba_2"])?$row["giai_ba_2"]:"?" ?>
                                                    </b>
                                                    &nbsp;-&nbsp;
                                                    <b class="clblue" id="g33">
                                                        <?=isset($row["giai_ba_3"])?$row["giai_ba_3"]:"?" ?>
                                                    </b>
                                                    &nbsp;-&nbsp;
                                                    <b class="clblue" id="g34">
                                                        <?=isset($row["giai_ba_4"])?$row["giai_ba_5"]:"?" ?>
                                                    </b>
                                                    &nbsp;-&nbsp;
                                                    <b class="clblue" id="g35">
                                                        <?=isset($row["giai_ba_5"])?$row["giai_ba_5"]:"?" ?>
                                                    </b>
                                                    &nbsp;-&nbsp;
                                                    <b class="clblue" id="g36">
                                                        <?=isset($row["giai_ba_6"])?$row["giai_ba_6"]:"?" ?>
                                                    </b>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td class="text-left"><strong>Giải  tư</strong></td>
                                                <td class="text-left">
                                                    <b class="clblue" id="g41">
                                                        <?=isset($row["giai_tu_1"])?$row["giai_tu_1"]:"?" ?>
                                                    </b>
                                                    &nbsp;-&nbsp;
                                                    <b class="clblue" id="g42">
                                                        <?=isset($row["giai_tu_2"])?$row["giai_tu_2"]:"?" ?>
                                                    </b>
                                                    &nbsp;-&nbsp;
                                                    <b class="clblue" id="g43">
                                                        <?=isset($row["giai_tu_3"])?$row["giai_tu_3"]:"?" ?>
                                                    </b>
                                                    &nbsp;-&nbsp;
                                                    <b class="clblue" id="g44">
                                                        <?=isset($row["giai_tu_4"])?$row["giai_tu_4"]:"?" ?>
                                                    </b></td>
                                            </tr>
                                            <tr>
                                                <td class="text-left"><strong>Giải  năm</strong></td>
                                                <td class="text-left">
                                                    <b class="clblue" id="g51">
                                                        <?=isset($row["giai_nam_1"])?$row["giai_nam_1"]:"?" ?>
                                                    </b>
                                                    &nbsp;-&nbsp;
                                                    <b class="clblue" id="g52">
                                                        <?=isset($row["giai_nam_2"])?$row["giai_nam_2"]:"?" ?>
                                                    </b>
                                                    &nbsp;-&nbsp;
                                                    <b class="clblue" id="g53">
                                                        <?=isset($row["giai_nam_3"])?$row["giai_nam_3"]:"?" ?>
                                                    </b>
                                                    &nbsp;-&nbsp;
                                                    <b class="clblue" id="g54">
                                                        <?=isset($row["giai_nam_4"])?$row["giai_nam_4"]:"?" ?>
                                                    </b>
                                                    &nbsp;-&nbsp;
                                                    <b class="clblue" id="g55">
                                                        <?=isset($row["giai_nam_5"])?$row["giai_nam_5"]:"?" ?>
                                                    </b></td>
                                            </tr>
                                            <tr>
                                                <td class="text-left"><strong>Giải  sáu</strong></td>
                                                <td class="text-left">
                                                    <b class="clblue" id="g61">
                                                        <?=isset($row["giai_sau_1"])?$row["giai_sau_1"]:"?" ?>
                                                    </b>
                                                    &nbsp;-&nbsp;
                                                    <b class="clblue" id="g62">
                                                        <?=isset($row["giai_sau_2"])?$row["giai_sau_2"]:"?" ?>
                                                    </b>
                                                    &nbsp;-&nbsp;
                                                    <b class="clblue" id="g63">
                                                        <?=isset($row["giai_sau_3"])?$row["giai_sau_3"]:"?" ?>
                                                    </b></td>
                                            </tr>
                                            <tr>
                                                <td class="text-left"><strong>Giải  bảy</strong></td>
                                                <td class="text-left">
                                                    <b class="clblue" id="g71">
                                                        <?=isset($row["giai_bay_1"])?$row["giai_bay_1"]:"?" ?>
                                                    </b>
                                                    &nbsp;-&nbsp;
                                                    <b class="clblue" id="g72">
                                                        <?=isset($row["giai_bay_2"])?$row["giai_bay_2"]:"?" ?>
                                                    </b>
                                                    &nbsp;-&nbsp;
                                                    <b class="clblue" id="g73">
                                                        <?=isset($row["giai_bay_3"])?$row["giai_bay_3"]:"?" ?>
                                                    </b>
                                                    &nbsp;-&nbsp;
                                                    <b class="clblue" id="g74">
                                                        <?=isset($row["giai_bay_4"])?$row["giai_bay_4"]:"?" ?>
                                                    </b></td>
                                            </tr>
                                        </tbody>
                                    </table> 
                                </div>
                            </td>
                        </tr>
                    </tbody>
                </table>
            </div>
            <div id="result_sbmit"></div>
        </div>
    </div>
</div>
<script type="text/javascript">
    var ngay_quay = '<?=date("Y-m-d",time()) ?>';

    function checkKetqua(ten_giai,value,max,divId){

        if(isNaN(value)){
            $("#result_sbmit").html("<a class='clred'>Giải "+ten_giai+" phải là số!</a>");
            $("#"+divId).focus();
            return false;
        }
        if(value.length < max){
            $("#result_sbmit").html("<a class='clred'>Giải "+ten_giai+" phải là số gồm 5 chữ số!</a>");
            $("#"+divId).focus();
            return false; 
        }
        $("#result_sbmit").html("");
        return true;            
    } 

    function saveDacbiet(){
        var strUrl = '<?=$url->createUrl("trongngay/saveDacbiet") ?>';
        var giai_dacbiet = $("#giai_dacbiet").val();
        var check = checkKetqua("đặc biệt",giai_dacbiet,5,'giai_dacbiet');
        if(check){ 
            $.ajax({
                type: "POST",
                url: strUrl,
                data: {
                    giai_dacbiet:giai_dacbiet,
                    ngay_quay:ngay_quay
                },
                success: function(msg){

                    $("#giai_db").removeClass("loading");
                    if(msg==1){
                        $("#giai_db").html("OK");
                        $("#gdb").html(giai_dacbiet);
                    }else{
                        $("#giai_db").html("Loi");
                    }        
                },
                beforeSend:function(){
                    $("#giai_db").html("");
                    $("#giai_db").addClass("loading");
                }
            });
        }  
    }
    
    function saveGiaiNhat(){  
        var strUrl = '<?=$url->createUrl("trongngay/saveGiaiNhat") ?>';
        var giai_nhat = $("#giai_nhat").val();
        var check = checkKetqua("nhất",giai_nhat,5,'giai_nhat');
        if(check){
            $.ajax({
                type: "POST",
                url: strUrl,
                data: {
                    giai_nhat:giai_nhat,
                    ngay_quay:ngay_quay
                },
                success: function(msg){
                    $("#giai_mot").removeClass("loading");
                    if(msg==1){
                        $("#giai_mot").html("OK");
                        $("#g1").html(giai_nhat);
                    }else{
                        $("#giai_mot").html("Loi");
                    }       
                },
                beforeSend:function(){
                    $("#giai_mot").html("");
                    $("#giai_mot").addClass("loading");
                }
            }); 
        }   
    }
    
    function saveGiaiNhi(){     
        var strUrl = '<?=$url->createUrl("trongngay/saveGiaiNhi") ?>';
        var giai_nhi_1 = $("#giai_nhi_1").val();
        var giai_nhi_2 = $("#giai_nhi_2").val();
        var check1 = checkKetqua("nhì 1",giai_nhi_1,5,'giai_nhi_1');
        
        if(check1){
            var check2 = checkKetqua("nhì 2",giai_nhi_2,5,'giai_nhi_2'); 
            if(check2){
                $.ajax({
                    type: "POST",
                    url: strUrl,
                    data: {
                        giai_nhi_1:giai_nhi_1,
                        giai_nhi_2:giai_nhi_2,
                        ngay_quay:ngay_quay
                    },
                    success: function(msg){
                        $("#giai_nhi").removeClass("loading");
                        if(msg==1){
                            $("#giai_nhi").html("OK");
                            $("#g21").html(giai_nhi_1);
                            $("#g22").html(giai_nhi_2);
                        }else{
                            $("#giai_nhi").html("Loi");
                        }       
                    },
                    beforeSend:function(){
                        $("#giai_nhi").html(""); 
                        $("#giai_nhi").addClass("loading");
                    }
                });     
            }
        }   
    }
    function saveGiaiBa(){  
        var strUrl = '<?=$url->createUrl("trongngay/saveGiaiBa") ?>';
        var giai_ba_1 = $("#giai_ba_1").val();
        var giai_ba_2 = $("#giai_ba_2").val();
        var giai_ba_3 = $("#giai_ba_3").val();
        var giai_ba_4 = $("#giai_ba_4").val();
        var giai_ba_5 = $("#giai_ba_5").val();
        var giai_ba_6 = $("#giai_ba_6").val();
        $.ajax({
            type: "POST",
            url: strUrl,
            data: {
                giai_ba_1:giai_ba_1,
                giai_ba_2:giai_ba_2,
                giai_ba_3:giai_ba_3,
                giai_ba_4:giai_ba_4,
                giai_ba_5:giai_ba_5,
                giai_ba_6:giai_ba_6,
                ngay_quay:ngay_quay
            },
            success: function(msg){
                $("#giai_ba").removeClass("loading");
                if(msg==1){
                    $("#giai_ba").html("OK");  
                    $("#g31").html(giai_ba_1);
                    $("#g32").html(giai_ba_2);
                    $("#g33").html(giai_ba_3);
                    $("#g34").html(giai_ba_4);
                    $("#g35").html(giai_ba_5);
                    $("#g36").html(giai_ba_6);
                }else{
                    $("#giai_ba").html("Loi");
                }       
            },
            beforeSend:function(){
                $("#giai_ba").html("");
                $("#giai_ba").addClass("loading");
            }
        });    
    }
    function saveGiaiTu(){  
        var strUrl = '<?=$url->createUrl("trongngay/saveGiaiTu") ?>';
        var giai_tu_1 = $("#giai_tu_1").val();
        var giai_tu_2 = $("#giai_tu_2").val();
        var giai_tu_3 = $("#giai_tu_3").val();
        var giai_tu_4 = $("#giai_tu_4").val();

        $.ajax({
            type: "POST",
            url: strUrl,
            data: {
                giai_tu_1:giai_tu_1,
                giai_tu_2:giai_tu_2,
                giai_tu_3:giai_tu_3,
                giai_tu_4:giai_tu_4,
                ngay_quay:ngay_quay
            },
            success: function(msg){
                $("#giai_tu").removeClass("loading");
                if(msg==1){
                    $("#giai_tu").html("OK");
                    $("#g41").html(giai_tu_1);
                    $("#g42").html(giai_tu_2);
                    $("#g43").html(giai_tu_3);
                    $("#g44").html(giai_tu_4);
                }else{
                    $("#giai_tu").html("Loi");
                }       
            },
            beforeSend:function(){
                $("#giai_nam").html("");
                $("#giai_tu").addClass("loading");
            }
        });    
    }
    function saveGiaiNam(){   
        var strUrl = '<?=$url->createUrl("trongngay/saveGiaiNam") ?>';
        var giai_nam_1 = $("#giai_nam_1").val();
        var giai_nam_2 = $("#giai_nam_2").val();
        var giai_nam_3 = $("#giai_nam_3").val();
        var giai_nam_4 = $("#giai_nam_4").val();
        var giai_nam_5 = $("#giai_nam_5").val();
        var giai_nam_6 = $("#giai_nam_6").val();
        //alert(giai_nam_1);
        $.ajax({
            type: "POST",
            url: strUrl,
            data: {
                giai_nam_1:giai_nam_1,
                giai_nam_2:giai_nam_2,
                giai_nam_3:giai_nam_3,
                giai_nam_4:giai_nam_4,
                giai_nam_5:giai_nam_5,
                giai_nam_6:giai_nam_6,
                ngay_quay:ngay_quay
            },
            success: function(msg){
                $("#giai_nam").removeClass("loading");
                if(msg==1){
                    $("#giai_nam").html("OK");
                    $("#g51").html(giai_nam_1);
                    $("#g52").html(giai_nam_2);
                    $("#g53").html(giai_nam_3);
                    $("#g54").html(giai_nam_4);
                    $("#g55").html(giai_nam_5);
                    $("#g56").html(giai_nam_6);
                }else{
                    $("#giai_nam").html("Loi");
                }       
            },
            beforeSend:function(){
                $("#giai_nam").html("");
                $("#giai_nam").addClass("loading");
            }
        });    
    }
    function saveGiaiSau(){     
        var strUrl = '<?=$url->createUrl("trongngay/saveGiaiSau") ?>';
        var giai_sau_1 = $("#giai_sau_1").val();
        var giai_sau_2 = $("#giai_sau_2").val();
        var giai_sau_3 = $("#giai_sau_3").val();
        $.ajax({
            type: "POST",
            url: strUrl,
            data: {
                giai_sau_1:giai_sau_1,
                giai_sau_2:giai_sau_2,
                giai_sau_3:giai_sau_3,
                ngay_quay:ngay_quay
            },
            success: function(msg){
                $("#giai_sau").removeClass("loading");
                if(msg==1){
                    $("#giai_sau").html("OK");
                    $("#g61").html(giai_sau_1);
                    $("#g62").html(giai_sau_2);
                    $("#g63").html(giai_sau_3);
                }else{
                    $("#giai_sau").html("Loi");
                }       
            },
            beforeSend:function(){
                $("#giai_sau").html("");
                $("#giai_sau").addClass("loading");
            }
        });    
    }
    function saveGiaiBay(){  
        var strUrl = '<?=$url->createUrl("trongngay/saveGiaiBay") ?>';
        var giai_bay_1 = $("#giai_bay_1").val();
        var giai_bay_2 = $("#giai_bay_2").val();
        var giai_bay_3 = $("#giai_bay_3").val();
        var giai_bay_4 = $("#giai_bay_4").val();
        $.ajax({
            type: "POST",
            url: strUrl,
            data: {
                giai_bay_1:giai_bay_1,
                giai_bay_2:giai_bay_2,
                giai_bay_3:giai_bay_3,
                giai_bay_4:giai_bay_4,
                ngay_quay:ngay_quay
            },
            success: function(msg){
                $("#giai_bay").removeClass("loading");
                if(msg==1){                   
                    $("#giai_bay").html("OK");
                    $("#g71").html(giai_bay_1);
                    $("#g72").html(giai_bay_2);
                    $("#g73").html(giai_bay_3);
                    $("#g74").html(giai_bay_4);
                }else{
                    $("#giai_bay").html("Loi");
                }       
            },
            beforeSend:function(){
                $("#giai_bay").html("");
                $("#giai_bay").addClass("loading");
            }
        });    
    }
</script>
